home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / doors_2 / sdoor102.zip / SDOOR.BI next >
Text File  |  1992-03-25  |  15KB  |  445 lines

  1. '                             ---FUNCTIONS---
  2.  
  3. DECLARE FUNCTION AColor$ (Fore%, Back%)
  4. '       Makes an optimized ansi color string
  5. '       Fore% = Foreground color to use
  6. '       Back% = Background color to use
  7. '
  8. '       EXAMPLE:
  9. '               Send AColor$(7,1)+"White on blue"
  10.  
  11. DECLARE FUNCTION CtrlCK% ()
  12. '       Checks if Control C/K have been checked.  Also enables Control C/K
  13. '       checking.  Returns -1 if true, 0 if not true.
  14. '
  15. '       EXAMPLE:
  16. '               IF CtrlCK% THEN
  17. '                       FlushOut
  18. '                       SendCr "Aborted."
  19. '               END IF
  20.  
  21. DECLARE FUNCTION Exist% (FileName$)
  22. '       Returns a non-zero value if the file exists.
  23. '
  24. '       EXAMPLE:
  25. '               IF Exist%("TEST.TTT") THEN Send "File FOUND"
  26.  
  27. DECLARE FUNCTION GetAnsi% ()
  28. '       Gets the current ansi setting.  Returns -1 if true, 0 if not true.
  29. '
  30. '       EXAMPLE:
  31. '               AnsiMode%=GetAnsi%
  32. '               IF AnsiMode% THEN
  33. '                       SendCr "Ansi is active"
  34. '               ELSE
  35. '                       SendCr "Ansi is not active"
  36. '               END IF
  37.  
  38. DECLARE FUNCTION GetBaudRate& ()
  39. '       Gets the current baud rate of the user (Door Info).  0 if local.
  40. '
  41. '       EXAMPLE:
  42. '               Send "You are running at" + STR$(GetBaudRate&)
  43.  
  44. DECLARE FUNCTION GetBBSName$ ()
  45. '       Gets the BBS name from the door file.
  46. '
  47. '       EXAMPLE:
  48. '               SendCr "Your sysop is: " + GetSysopName$
  49.  
  50. DECLARE FUNCTION GetCarrier% ()
  51. '       Gets the current carrier state.  Non-zero if there is a carrier.
  52. '       The user's carrier is automatically managed.  This is not really
  53. '       needed.
  54. '
  55. '       EXAMPLE:
  56. '               IF GetCarrier% THEN Send "YOU ARE STILL CONNECTED"
  57.  
  58. DECLARE FUNCTION GetPort% ()
  59. '       Gets the current serial port setting.  -1 if local
  60. '
  61. '       EXAMPLE:
  62. '               Send "You are on com port" + STR$(GetPort%)
  63.  
  64. DECLARE FUNCTION GetSecLevel& ()
  65. '       Gets the user's security level.
  66. '
  67. '       EXAMPLE:
  68. '               Send "Your security Level is" + STR$(GetSecLevel&)
  69.  
  70. DECLARE FUNCTION GetSnoopState% ()
  71. '       Gets the status of the snoop setting on the SysOp's side.
  72. '       Returns -1 if true, 0 if not.
  73. '
  74. '       EXAMPLE:
  75. '               IF GetSnoopState% THEN
  76. '                       Send "Snoop is ON"
  77. '               ELSE
  78. '                       Send "Snoop is OFF"
  79. '               ENDIF
  80.  
  81. DECLARE FUNCTION GetSysopName$ ()
  82. '       Gets the sysop's name,  in all uppercase.
  83. '
  84. '       EXAMPLE:
  85. '               Send "Your sysop is: " + GetSysopname$
  86.  
  87. DECLARE FUNCTION GetTimeLeft% ()
  88. '       Gets the amount of time the user has left in minutes.
  89. '
  90. '       EXAMPLE:
  91. '               Send "You have" + STR$(GetTimeLeft%)+" minutes left."
  92.  
  93. DECLARE FUNCTION GetUserLocation$ ()
  94. '       Gets the user's location (DOOR INFO) in all uppercase
  95. '
  96. '       EXAMPLE:
  97. '               Send "Your location is: " + GetUserLocation$
  98.  
  99. DECLARE FUNCTION GetUserName$ ()
  100. '       Gets the user's name (DOOR INFO) in all uppercase
  101. '
  102. '       EXAMPLE:
  103. '               Send "Your name is: " + GetUserName$
  104.  
  105. '                          ---END OF FUNCTIONS---
  106. '                            ---SUBROUTINES---
  107.  
  108. DECLARE SUB Center (St$)
  109. '       Centers the specified text and stays on the same line.
  110. '
  111. '       EXAMPLE:
  112. '               Center "Testing the centering routine"
  113.  
  114. DECLARE SUB CenterCr (St$)
  115. '       Centers the specified text and creates a new line.
  116. '
  117. '       EXAMPLE:
  118. '               CenterCr "Testing the centering routine"
  119.  
  120. DECLARE SUB Chat ()
  121. '       Starts a chatmode with the user.  Restores the colors to normal
  122. '       afterwards.
  123. '
  124. '       EXAMPLE:
  125. '               SendCr "Forced CHAT:"
  126. '               Chat
  127.  
  128.  
  129. DECLARE SUB ClearScreen ()
  130. '       Clears the screen
  131. '
  132. '       EXAMPLE:
  133. '               ClearScreen
  134.  
  135. DECLARE SUB ComParms (BaudRate&, Flag$)
  136. '       Sets the communications parameters.  These are already set upon
  137. '       initialization.  There should be no need to play with them.
  138. '
  139. '       BaudRate& can be:  300, 600, 1200, 2400, 4800, 9600, 19200, 38400
  140. '       Flag$ takes the form of: "8N1" where the 8 can be replaced by:
  141. '                                       5, 6, 7, 8   (Data bits)
  142. '                                and the N can be replaced by:
  143. '                                       N, O, E      (Parity)
  144. '                                and the 1 can be replaced by:
  145. '                                       1, 2         (Stop bits)
  146. '
  147. '       EXAMPLE:
  148. '               ComParms 2400, "8N1"
  149.  
  150. DECLARE SUB CtrlCKOn ()
  151. '       Turns on Control-C/K checking.
  152. '
  153. '       EXAMPLE:
  154. '               CtrlCKOn
  155.  
  156. DECLARE SUB CtrlCKOff ()
  157. '       Turns off Control-C/K checking.
  158. '
  159. '       EXAMPLE:
  160. '               CtrlCKOff
  161.  
  162. DECLARE SUB DeInitialize ()
  163. '       Turns off the status bar and removes it from the screen.  Disables
  164. '       the door driver and turns off the door driver's internal error
  165. '       checking.  Also causes Send, SendCr, and all other routines to
  166. '       malfunction.  DO NOT DO ANY OTHER DOORDRIVER CALLS AFTER
  167. '       DEINITIALIZING!  DOES NOT TERMINATE THE PROGRAM.
  168. '
  169. '       EXAMPLE:
  170. '               DeInitialize
  171. '               Print "Cleaning up after door"
  172. '               END
  173.  
  174. DECLARE SUB DetectAnsi (Ansi%)
  175. '       Detects Ansi (Remote user)
  176. '       Returns -1 or 0 into Ansi% (or any other variable of your choice)
  177. '
  178. '       EXAMPLE:
  179. '               DetectAnsi Ansi%                    
  180. '               SetAnsi Ansi%
  181.  
  182. DECLARE SUB FlushIn ()
  183. '       Flushes the inbound modem buffer.  Wipes all user keystrokes.
  184. '
  185. '       EXAMPLE:
  186. '               FlushIn
  187. '               Send "What now sire? "
  188. '               GetChar ToDoThis$
  189. '               SendCr ToDoThis$
  190.  
  191. DECLARE SUB FlushOut ()
  192. '       Flushes the outbound modem buffer.  Usefull for stopping screens
  193. '       when Control-C/K have been pressed.
  194. '
  195. '       EXAMPLE:
  196. '               SendCr "Press Control-C/K to stop this mess"
  197. '               CtrlCKOn
  198. '               DO
  199. '                       SendCr "Testing 1234567890..."
  200. '                       I$ = Inkey$
  201. '               LOOP UNTIL I$ = CHR$(3) OR I$ = CHR$(11) OR CtrlCK%
  202. '               SendCr "Aborted."
  203.  
  204. DECLARE SUB GetChar (Ch$)
  205. '       Gets a character from the modem into Ch$.  (Ch$ can be any
  206. '       variable)
  207. '
  208. '       EXAMPLE:
  209. '               SendCr "Yo there dude!  Press any key please!"
  210. '               GetChar Test$
  211. '               SendCr "Thanks!"
  212.  
  213. DECLARE SUB GetColor (Fore%, Back%)
  214. '       Gets the current foreground and background colors.
  215. '   
  216. '       EXAMPLE:
  217. '               GetColor ForeGround%, BackGround%
  218. '               SendCr "The foreground color is: " + STR$(ForeGround%)
  219. '               SendCr "The background color is: " + STR$(BackGround%)
  220.  
  221. DECLARE SUB GetCurPos (X%, Y%)
  222. '       Gets the cursor position.
  223. '       X% = The Current Row
  224. '       Y% = The Current Column
  225. '
  226. '       EXAMPLE:
  227. '               GetCurPos X%, Y%
  228. '               SendCr "The row is: " + STR$(X%)
  229. '               SendCr "The column is: " + STR$(Y%)
  230.         
  231. DECLARE SUB GetString (St$, Max%, Mode%)
  232. '       Gets a string from the modem/console.
  233. '       St$ = The returned string.
  234. '       Max% = The max width/value.
  235. '       Mode% = Input mode:
  236. '               0  :-   Normal Input, exactly as entered.
  237. '                       Max% = Maximum length in characters.
  238. '               1  :-   UserName Input, Every first character of a word is
  239. '                       converted to uppercase.  Uppercase characters after
  240. '                       the first letter of each word are accepted.
  241. '                       Max% = Maximum length in characters.
  242. '               2  :-   Numeric input.  Allows from 0 to the number specified.
  243. '                       Allows blank strings for 0.  Returned value is a
  244. '                       string.
  245. '                       Max% = Maximum value (Integer value; 0 - 32767)
  246. '               3  :-   Password input.  Outputs dots (.) instead of entered
  247. '                       characters.  Case insensitive.
  248. '               4  :-   Telephone number.  Allows all numbers, brackets ()
  249. '                       and the dash.
  250. '
  251. '       EXAMPLES:
  252. '               GetString Test$, 20, 0  'Gets a string of 20 characters long
  253. '                                       'into Test$ with no restrictions.
  254. '               GetString Test$, 20, 1  'Gets a string of 20 characters long
  255. '                                       'into Test$, with username style
  256. '                                       'input.
  257. '               GetString Test$, 128, 2 'Gets a number into Test$.  Max 128
  258. '               GetString Test$, 20, 3  'Gets a password of 20 chars max.
  259. '               GetString Test$, 14, 4  'Gets a telephone number of 14 chars
  260. '                                       'maximum.
  261.  
  262. DECLARE SUB Hangup ()
  263. '       Hangs up the user.
  264. '
  265. '       EXAMPLE:
  266. '               Hangup
  267.  
  268. DECLARE SUB Initialize (DOORFile$, ProgName$)
  269. '       Initializes the door driver routines.
  270. '       DOORFile$ = The path and filename of the DORINFOx.DEF file
  271. '       ProgName$ = The name of the door.  Only for registered versions.
  272. '
  273. '       EXAMPLES:
  274. '               DoorFile$ = "\BBS\DORINFO1.DEF"
  275. '               Intialize DoorFile$,"Test Door"
  276. '
  277.  
  278. DECLARE SUB LineFeed (Lines%)
  279. '       Sends (Lines%) CR/FL pairs.
  280. '
  281. '       EXAMPLE:
  282. '               LineFeed 20
  283.  
  284. DECLARE SUB OfficePhone (Duration!)
  285. '       Makes a sound similar to an office phone until any key is pressed
  286. '       or the number of seconds specified in Duration! has elapsed!
  287. '
  288. '       EXAMPLE:
  289. '               OfficePhone 30
  290.  
  291. DECLARE SUB ReInitPort ()
  292. '       ReInitializes the com port.  Not needed, but here anyways.
  293. '
  294. '       EXAMPLE:
  295. '               ReInitPort
  296.  
  297. DECLARE SUB ResetIdle ()
  298. '       Resets the idle time counter to zero.
  299. '       Is called upon every Send, SendCr, GetChar (after keypress),
  300. '       GetString, SendFile, SetColor, Center, CenterCr.
  301. '
  302. '       EXAMPLE:
  303. '               ResetIdle
  304.  
  305. DECLARE SUB Send (St$)
  306. '       Sends the specified string to the modem/screen if snoop is on.
  307. '       St$ = The string to send.
  308. '
  309. '       EXAMPLE:
  310. '               Send "Testing 123"
  311.  
  312. DECLARE SUB SendCr (St$)
  313. '       Sends the specified string to the modem/screen and appends a CR/LF
  314. '       pair at the end of it.
  315. '       St$ = The string to send.
  316. '
  317. '       EXAMPLE:
  318. '               SendCr "This is on the line above the line below."
  319. '               SendCr "This is on the line below the libe above."
  320.  
  321. DECLARE SUB SendFile (FileName$, More%, Ck%, Er%)
  322. '       Sends a file to the modem/screen.
  323. '       FileName$ is the full path/filename of a file to display.  Defaults
  324. '        to the current directory.
  325. '        If the extension is supplied, your program must determine itself if
  326. '        the user supports ANSI or not.  If you do not supply an extension,
  327. '        the door driver will attempt to locate a .ANS file if the user has
  328. '        ANSI active, if not, it will resort to ASCII (.ASC) and if that
  329. '        fails, it will then assume "File not found".
  330. '       More% is the toggle for the More prompt.  A non-zero value will
  331. '        activate it.  A user can use Ctrl-C/K as a "NO" at the More prompt.
  332. '       Ck% is the toggle for Control-C/K aborting.  If this value is
  333. '        non-zero, then Ctrl-K/C from either side will stop the file from
  334. '        being displayed.  If you want the user to be forced to see the
  335. '        whole file, then I reccomend making your own sendfile routine and
  336. '        making it ask for any key to continue once per x lines.
  337. '       Er% is set to a non-zero value if the file isn't found.
  338. '       This routine cannot handle disk IO errors, so the SumDoor error
  339. '       handler is called upon to do the dirty work.  This means the game
  340. '       will terminate.
  341. '
  342. '       EXAMPLE:
  343. '               SendFile "TEST",0,1,Er%
  344. '               IF Er% THEN SendCr "Hey, where'd my file go?"
  345.  
  346. DECLARE SUB SetAnsi (AnsiState%)
  347. '       Sets the user's ANSI state.  Not reccomended unless the user changes
  348. '       it themselves.
  349. '
  350. '       EXAMPLE:
  351. '               Send "You have ansi "
  352. '               AnsiMode%=GetAnsi%
  353. '               IF AnsiMode% THEN
  354. '                       SendCr "enabled"
  355. '               ELSE
  356. '                       SendCr "disabled"
  357. '               ENDIF
  358.  
  359. DECLARE SUB SetColor (Fore%, Back%)
  360. '       Sets the color.
  361. '       Fore% = Foreground color
  362. '
  363. '        Color systems------------------------- Monochrome systems-------
  364. '
  365. '        0  - Black        1  - Blue            0 -  Black
  366. '        2  - Green        3  - Cyan            1 -  Underline
  367. '        4  - Red          5  - Magenta         2 to 7 -  Normal
  368. '        6  - Brown        7  - White           8 -  Black
  369. '        8  - Gray         9  - Light Blue      9 -  Intense Underline
  370. '        10 - Light Green  11 - Light Cyan      10 to 15 -  Intense
  371. '        12 - Light Red    13 - Light Magenta
  372. '        14 - Yellow       15 - Light White
  373. '
  374. '       Back% = Background color
  375. '
  376. '       Color systems-------------------------- Monochrome systems-------
  377. '
  378. '        0  - Black        1  - Blue            0 to 6 -  Black
  379. '        2  - Green        3  - Cyan            7 -  White (Only with 0 as
  380. '        4  - Red          5  - Magenta              foreground)
  381. '        6  - Brown        7  - White
  382. '
  383. '       EXAMPLE:
  384. '               SetColor 7,1            'White on blue
  385.  
  386. DECLARE SUB SetCurPos (X%, Y%)
  387. '       Sets the cursor position (ONLY WHEN ANSI IS ACTIVE)
  388. '       X% = Row%
  389. '       Y% = Col%
  390. '       WARNING: No internal checking for the Row% is done.  It must not
  391. '       exceed 24 if you want to maintain compatibility with old ansi
  392. '       terminals.
  393. '
  394. '       EXAMPLE:
  395. '               SetCurPos 9, 1
  396.  
  397. DECLARE SUB SetIdle (IdleTim%)
  398. '       Sets the idle timeout value (defaults to 240 seconds on startup)
  399. '       IdleTim% = number of seconds before idle timeout.  Gives idle
  400. '        warning at 30 seconds left.
  401. '
  402. '       EXAMPLE:
  403. '               SetIdle 250
  404.  
  405. DECLARE SUB SetSnoopState (SnSt%)
  406. '       Sets the Snoop state.
  407. '       SnSt% - The snoop state flag.  Any non-zero value turns on snoop.
  408. '       Zero turns it off.
  409. '
  410. '       EXAMPLE:
  411. '               SetSnoopState -1
  412.  
  413. DECLARE SUB StatBarOff ()
  414. '       Turns off status bar updates (and disables carrier/timelimit
  415. '       checking)
  416. '       GOOD FOR DISK I/O WHEN REWRITING DATAFILES!
  417. '
  418. '       EXAMPLE:
  419. '               SendCr "Updating Datafile"
  420. '               StatBatOff
  421. '               .
  422. '               .
  423. '               .
  424. '               StatBarOn
  425.  
  426. DECLARE SUB StatBarOn ()
  427. '       Turns on the status bar.  (and enables carrier/timelimit checking)
  428. '
  429. '       EXAMPLE:
  430. '               [See Previous Command]
  431.  
  432. DECLARE SUB StatusBar ()
  433. '       Forces an update of the status bar.
  434. '
  435. '       EXAMPLE:
  436. '               StatusBar
  437.  
  438. DECLARE SUB ToggleSnoop ()
  439. '       Toggles the snoop setting.
  440. '
  441. '       EXAMPLE:
  442. '               ToggleSnoop
  443.  
  444.  
  445.